<template>
	<view class="rejectReport">
		<view class="maintainProjectCode-content ff-bg-fff ff-color-222 ff-font-14 ff-margin-12 ff-border-radius-10">
			<view class="ff-font-weight-600 ff-padding-left-15 ff-padding-top-15 ff-font-15 ff-margin-bottom-5">驳回此报告
			</view>
			<view class="ff-padding-15 ff-border-bottom">
				<u-input type="textarea" maxlength="-1" height="200" :clearable="false" :border="true"
					v-model="params.reportRefuseReason" placeholder="请输入驳回原因" />
			</view>
		</view>
		<view class="rejectReport-but"><u-button type="primary" shape="circle" @click="submitCodeClick">确定提交</u-button>
		</view>
		<f-loading ref="loading" />
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		name: 'rejectReport',
		data() {
			return {
				params: {
					maintenanceId: '',
					reportRefuseReason: ''
				}
			};
		},
		onLoad(e) {
			this.params.maintenanceId = e.id;
		},
		methods: {
			// 提交驳回原因
			submitCodeClick() {
				let that = this;
				if (!that.params.reportRefuseReason) {
					that.$refs.uToast.show({
						title: '请输入驳回原因',
						type: 'error'
					});
					return;
				}
				that.$refs.loading.openLoading('提交中···'); // 打开loading动画
				that.$http
					.post({
						url: `/serviceOrg/refuseMaintenance/v2`,
						data: that.params
					})
					.then(res => {
						// console.log('提交驳回理由返回的结果-----', res);
						that.$refs.loading.closeLoading(); // 关闭loading动画
						if (res.code == 200) {
							that.$refs.uToast.show({
								title: res.msg,
								type: 'success'
							});
							setTimeout(() => {
								that.$pageJump.reLaunch('/pages/maintenance/mechanism/Maintenance');
							}, 500);
						} else {
							that.$refs.uToast.show({
								title: res.msg,
								type: 'error'
							});
						}
					});
			}
		},
		onShareAppMessage() {
			return {
				title: '分享小程序给朋友',
				path: '/pages/homePage/Home'
			};
		}
	};
</script>

<style lang="scss" scoped>
	.rejectReport {
		&-but {
			width: 90%;
			margin: 12% 5%;

			/deep/.u-size-default {
				height: 90rpx !important;
				line-height: 90rpx !important;
			}
		}
	}
</style>